package de.pnp.kniffel.scorecard;

/**
 * Klasse zum Erzeugen von Task-Objekten.
 * 
 * @author Peter
 */
public class TaskFactory {
	/**
	 * Factory-Methode zum Erzeugen von konkreten Objekten des Typs Task.
	 * 
	 * @param type
	 *            Typ des zu erzeugenden Objekts.
	 * @return Erzeugtes Objekt.
	 */
	public static Task CreateTask(Scorecard scorecard, TaskType type) {
		switch (type) {
		case ACES:
			return new TaskAces(scorecard);
		case TWOS:
			return new TaskTwos(scorecard);
		case THREES:
			return new TaskThrees(scorecard);
		case FOURS:
			return new TaskFours(scorecard);
		case FIVES:
			return new TaskFives(scorecard);
		case SIXES:
			return new TaskSixes(scorecard);
		case THREE_OF_A_KIND:
			return new TaskThreeOfAKind(scorecard);
		case FOUR_OF_A_KIND:
			return new TaskFourOfAKind(scorecard);
		case FULL_HOUSE:
			return new TaskFullHouse(scorecard);
		case SMALL_STRAIGHT:
			return new TaskSmallStraight(scorecard);
		case LARGE_STRAIGHT:
			return new TaskLargeStraight(scorecard);
		case YAHTZEE:
			return new TaskYahtzee(scorecard);
		case CHANCE:
			return new TaskChance(scorecard);
		default:
			return null;
		}
	}
}
